# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=i3wm
pkgver=4.20.1
pkgrel=0
pkgdesc="Improved dynamic tiling window manager"
url="https://i3wm.org"
arch="all"
license="BSD-3-Clause"
depends_dev="$pkgname=$pkgver-r$pkgrel" # -dev only has headers
makedepends="
	meson
	bash
	bison
	cairo-dev
	flex
	libev-dev
	libxcb-dev
	libxkbcommon-dev
	pango-dev
	pcre-dev
	perl
	startup-notification-dev
	xcb-util-cursor-dev
	xcb-util-keysyms-dev
	xcb-util-wm-dev
	xcb-util-xrm-dev
	yajl-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-save_tree:savetree:noarch
	"
source="
	https://i3wm.org/downloads/i3-$pkgver.tar.xz
	"
builddir="$srcdir/i3-$pkgver"
options="!check" # missing perl bindings for libxcb

build() {
	abuild-meson . output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

savetree() {
	pkgdesc="Session export tool for $pkgname"
	depends="$pkgname=$pkgver-r$pkgrel perl-anyevent-i3"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/i3-save-tree "$subpkgdir"/usr/bin/
}

sha512sums="
c0f6b991d46180ca470cbb7ab4cf5492552beb9dbf2631c61c8d92d0647106885481962381682e9129f3993d70bc6e5de506da1d32c3710fca64a66d51e8c8ce  i3-4.20.1.tar.xz
"
